@extends('Admin.layout.layout')
@section('title','用户列表')
@section('con')

	<div class="portlet-body">

		<div class="clearfix">

			<div class="btn-group">
				<a href="/admin/user/add" >
				<button id="sample_editable_1_new" class="btn green">

				添加新用户 <i class="icon-plus"></i>

				</button>
				</a>

			</div>

			<div class="btn-group pull-right">

				<button class="btn dropdown-toggle" data-toggle="dropdown">Tools <i class="icon-angle-down"></i>

				</button>

				<ul class="dropdown-menu pull-right">

					<li><a href="#">Print</a></li>

					<li><a href="#">Save as PDF</a></li>

					<li><a href="#">Export to Excel</a></li>

				</ul>

			</div>

		</div>

		<!-- 搜索表单------------------------- -->
		<form action="{{url('admin/user/index')}}" method="get">
		<div id="sample_editable_1_wrapper" class="dataTables_wrapper form-inline" role="grid">
			<div class="row-fluid">
				<div class="span6">
					<div id="sample_editable_1_length" class="dataTables_length">
				<label>
					显示
					<select size="1" name="num" aria-controls="sample_editable_1" class="m-wrap small select2-offscreen" tabindex="-1">

						<option value="10" @if(!empty($data['num']) && $data['num'] == 10){ selected } @endif>10</option>
						<option value="20" @if(!empty($data['num']) && $data['num'] == 20){ selected } @endif>20</option>
						<option value="50" @if(!empty($data['num']) && $data['num'] == 50){ selected } @endif>50</option>
						<option value="100" @if(!empty($data['num']) && $data['num'] == 100){ selected } @endif>100</option>



					</select> 条
				</label>
			</div>
		</div>
		<div class="span6">
			<div class="dataTables_filter" id="sample_editable_1_filter">
					<label>搜索: 

						<input name="keywords" value="{{$data['keywords'] or ''}}" aria-controls="sample_editable_1" class="m-wrap medium" type="text">

						<button class="btn blue dropdown-toggle" >搜索</button>
					</label></div></div></div><table class="table table-striped table-hover table-bordered dataTable" id="sample_editable_1" aria-describedby="sample_editable_1_info">
				</form>
				<!-- 搜索结束!!!!!!!!!!!! -->
			<thead>

				<tr role="row">
					<th class="sorting_disabled" role="columnheader" rowspan="1" colspan="1" style="width: 184px;" aria-label="Username">
						ID
					</th>
					<th class="sorting" role="columnheader" tabindex="0" aria-controls="sample_editable_1" rowspan="1" colspan="1" style="width: 262px;" aria-label="Full Name: activate to sort column ascending">
						用户名
					</th>
					<th class="sorting" role="columnheader" tabindex="0" aria-controls="sample_editable_1" rowspan="1" colspan="1" style="width: 123px;" aria-label="Points: activate to sort column ascending">

						手机号

					</th>
					<th class="sorting" role="columnheader" tabindex="0" aria-controls="sample_editable_1" rowspan="1" colspan="1" style="width: 128px;" aria-label="Delete: activate to sort column ascending">
						身份
					</th>
					<th class="sorting" role="columnheader" tabindex="0" aria-controls="sample_editable_1" rowspan="1" colspan="1" style="width: 176px;" aria-label="Notes: activate to sort column ascending">
						状态
					</th>
					<th class="sorting" role="columnheader" tabindex="0" aria-controls="sample_editable_1" rowspan="1" colspan="1" style="width: 87px;" aria-label="Edit: activate to sort column ascending">
						操作
					</th>
				</tr>

			</thead>

			
	<!-- 用户列表遍历 -->
		<tbody role="alert" aria-live="polite" aria-relevant="all">
				@foreach($users as $k=>$v)
				<tr class="odd">
			
					<td class="sid">{{$v->id}}</td>

					<td class=" ">{{$v->username}}</td>


					<td class=" ">{{$v->phone}}</td>

					
					<td class=" ">{{str_replace([0,1,2,3],['普通用户','VIP用户','作者','管理员'],$v->role)}}</td>

					<td class="center ">{{str_replace([0,1],['未激活','激活'],$v->state)}}</td>

					<td class=""><a href="{{url('/admin/user/delete',['id'=>$v->id])}}">删除</a> |<a href="{{url('/admin/user/edit',['id'=>$v->id])}}">修改</a></td>
				</tr>
				@endforeach
		</tbody>
		</table>
		<div class="row-fluid">
			<div class="span6" style="width:100%;height:20px">
				<div class="pagination" style="float:right;">

					{!! $users->appends($data)->render() !!}

				</div>
			</div>
		</div>
	</div>
</div>
@endsection
@section('myjs')
<script type="text/javascript">
	// $('.qwer').click(function()
	// {
	// 	var id = $(this).parents('tr').find('.sid').html();
	// 	// alert(id);
	// 	var bb = $(this);
	// 	$.get('/admin',{id:id},function(data){
	// 		if(data == 1){
	// 			bb.parents('tr').remove();
	// 			// alert("aaaa");
	// 		}else{
	// 			alert('删除失败');
	// 		}
	// 		// console.log(data);
	// 	});
		
	// });
</script>
@endsection